<template>
	<view class="material-index">
		<van-tabs @change="changeTab" color="#1152FC" animated :lazy-render="false" :active="active">
			<van-tab :title-style="active == 0 ? 'color: #1152FC': ''" title="耗材管理">
				<view class="top-box common">
					<navigator url="/materialSystem/materialApply/materialApply">
						<view>申领耗材</view>
					</navigator>
					<navigator url="/materialSystem/materialPurchase/materialPurchase">
						<view>耗材采购</view>
					</navigator>
					<navigator url="/materialSystem/materialEmerge/materialEmerge">
						<view>耗材退库</view>
					</navigator>
				</view>
				<view class="center-box common">
					
				</view>
				<view @click="goRecord" class="bottom-box common">
					<view @click="goRecord">
						申请记录
					</view>
					<view @click="goMyMaterial">
						我的物料
					</view>
				</view>
			</van-tab>
			<van-tab :title-style="active == 1 ? 'color: #1152FC': ''" title="资产管理">
				2
			</van-tab>
		</van-tabs>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				active: 0
			}
		},
		onLoad() {
			this.getGroupInfo()
		},
		methods: {
			getGroupInfo() {
				 this.$http.post('/sys/group/info',{id: this.$config.groupId}).then(res => {
					 if(res.code === 10000) {
						 uni.setStorageSync('groupName', res.data.name)
					 }
				 })
			},
			changeTab(name, title) {
				this.active = name.target.index
			},
			goRecord() {
				uni.navigateTo({
					url: '../applyRecord/applyRecord'
				})
			},
			goMyMaterial() {
				uni.navigateTo({
					url: '/materialSystem/myMaterial/myMaterial'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
.material-index {
	background-color: #f5f5f5;
}
.common {
	border-radius: 10rpx;
	background-color: #fff;
	margin: 30rpx 20rpx;
}
.top-box {
	width: 710rpx;
	height: 360rpx;
}
.center-box {
	width: 710rpx;
	height: 300rpx;
}
.bottom-box {
	width: 710rpx;
	height: 200rpx;
}
</style>
